<%-- 
    Document   : smsType9
    Created on : 11 Jan, 2013, 7:02:06 PM
    Author     : sagar
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../common/script.jsp" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <%@include file="../common/title.jsp" %>
         <script type="text/javascript">
            var rules=new Array();
            rules[0]='hospitalId|required|please Select Hospital';
        </script>
        <script type="text/javascript">
            var hospitalId;
            function selectSms(){
                $(function() {
                    $( "#hospitalId" ).autocomplete({
                        source: "../ajaxCallForSMSType14HospitalList.htm",
                        minLength: 1,
                        select: function(event, ui) { 
                            hospitalInfo=ui.item.value;
                            var array_1= new Array();
                            var array_1 = hospitalInfo.split("~",3);
                            for (var i=0;i<array_1.length;i++){
                               
                                hospitalId=array_1[2];
                            }
                    
                        }
                    
                    });
                });
            
                $.ajax({
                    data: ({'hospitalId1' :hospitalId}),
                    url: "../getHospitalInfo.htm",
                    dataType: "json",
                    success:function(json){
                        if(json!=null){
                            var hospitalName=json.hospitalName;
                            var hospitalAddress=json.hospitalAddress;
                            var hospitalPhoneNo=json.contact1;
                            var msBody14="Dear ${customer.customerName}, \n\
\n\
The address of "+hospitalName+" is "+hospitalAddress+". The phone number is "+hospitalPhoneNo+". \n\
Please call Healthspring on 8655589555 if you need any further assistance.\n\
\n\
Healthspring ";
                            document.getElementById("smsType14").value=msBody14;
                        }else{
                            
                        }
                    }
//                    error: function(e){
//                        alert("Error:  Please Enter Hospital ");
//                    }
                });

            } 
                
        </script>
    </head>
    <body onload="selectSms();yav.init('form1',rules,'inline');">
        <%@include file="../common/header.jsp" %>
        <%@include file="../common/menu.jsp" %>
        <div class="in_02">
            <form:form id="form1" name="form1"  method="POST">
                <fieldset>
                    <legend>Sending SMS For - Hospital Address</legend>
                    <table class="formTable">
                        <tr>
                            <td>
                                <label>Hospital Name:</label><br />
                                <input type="text" name="hospitalId" id="hospitalId"  class="userInputLarge" onchange="selectSms();" onblur="selectSms();"/>
                                <br/><span id="errorsDiv_hospitalId"></span><br/>
                            </td>
                        </tr>
                        <tr><td><span class="HeadingForSms"><b>Sent to Customer</b></span><br/><br/>
                                Message :<br/>
                                <textarea id="smsType14" name="smsType14"  value="${msBody14}"  class="TextAreaForSms" readonly=""/></textarea><br/>
                            </td>
                        </tr>
                        <tr>
                            <td><input type="submit" name="_finish"  value="<spring:message code="button.sendSms"/>" onclick="return yav.performCheck('form1', rules, 'inline'); ">
                            <input type="submit" name="_cancel"  value="<spring:message code="button.Cancel"/>"/></td>
                        </tr> 
                    </table>
                </fieldset>
            </form:form>
        </div>
    </body>
</html>
